chrome-devtools-frontend 1.0.1515988 → 1.0.1518653
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/checklist/README.md +2 -2
- package/docs/checklist/javascript.md +1 -1
- package/docs/contributing/README.md +1 -1
- package/docs/contributing/settings-experiments-features.md +9 -8
- package/docs/cookbook/devtools_on_devtools.md +2 -2
- package/docs/cookbook/localization.md +10 -10
- package/docs/devtools-protocol.md +9 -8
- package/docs/ecosystem/automatic_workspace_folders.md +3 -3
- package/docs/get_the_code.md +0 -2
- package/docs/styleguide/ux/components.md +166 -85
- package/docs/styleguide/ux/numbers.md +3 -4
- package/front_end/core/common/README.md +13 -12
- package/front_end/core/host/GdpClient.ts +16 -1
- package/front_end/core/host/UserMetrics.ts +8 -2
- package/front_end/core/root/Runtime.ts +13 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +5 -1
- package/front_end/entrypoints/main/MainImpl.ts +6 -3
- package/front_end/generated/InspectorBackendCommands.js +10 -7
- package/front_end/generated/SupportedCSSProperties.js +21 -7
- package/front_end/generated/protocol-mapping.d.ts +16 -1
- package/front_end/generated/protocol-proxy-api.d.ts +13 -1
- package/front_end/generated/protocol.ts +95 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +170 -54
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +14 -181
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +13 -315
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +224 -50
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +310 -11
- package/front_end/models/ai_assistance/performance/AIContext.ts +15 -2
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +41 -19
- package/front_end/models/badges/Badge.ts +8 -3
- package/front_end/models/badges/CodeWhispererBadge.ts +2 -4
- package/front_end/models/badges/StarterBadge.ts +2 -2
- package/front_end/models/badges/UserBadges.ts +59 -6
- package/front_end/models/formatter/FormatterWorkerPool.ts +3 -3
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/trace/README.md +28 -1
- package/front_end/models/trace/handlers/UserTimingsHandler.ts +1 -1
- package/front_end/models/trace/helpers/Trace.ts +99 -43
- package/front_end/models/trace/types/TraceEvents.ts +9 -0
- package/front_end/panels/accessibility/ARIAAttributesView.ts +113 -191
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +9 -9
- package/front_end/panels/accessibility/AccessibilitySubPane.ts +6 -4
- package/front_end/panels/accessibility/accessibilityProperties.css +2 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +16 -2
- package/front_end/panels/ai_assistance/components/ChatView.ts +9 -10
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +42 -0
- package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +32 -9
- package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +7 -1
- package/front_end/panels/common/BadgeNotification.ts +67 -15
- package/front_end/panels/common/GdpSignUpDialog.ts +18 -9
- package/front_end/panels/console/ConsolePrompt.ts +1 -1
- package/front_end/panels/console/ConsoleView.ts +6 -2
- package/front_end/panels/elements/ComputedStyleWidget.ts +1 -2
- package/front_end/panels/elements/ElementsPanel.ts +4 -0
- package/front_end/panels/elements/ElementsTreeElement.ts +18 -0
- package/front_end/panels/elements/ElementsTreeOutline.ts +13 -0
- package/front_end/panels/elements/LayoutPane.ts +1 -1
- package/front_end/panels/elements/StylePropertyTreeElement.ts +21 -6
- package/front_end/panels/media/TickingFlameChart.ts +1 -1
- package/front_end/panels/network/NetworkLogView.ts +5 -1
- package/front_end/panels/profiler/HeapSnapshotView.ts +34 -19
- package/front_end/panels/search/SearchResultsPane.ts +126 -145
- package/front_end/panels/search/SearchView.ts +43 -59
- package/front_end/panels/settings/components/SyncSection.ts +16 -8
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +6 -1
- package/front_end/panels/sources/OutlineQuickOpen.ts +3 -1
- package/front_end/panels/sources/SourcesPanel.ts +3 -0
- package/front_end/panels/timeline/AppenderUtils.ts +2 -2
- package/front_end/panels/timeline/ExtensionTrackAppender.ts +13 -4
- package/front_end/panels/timeline/GPUTrackAppender.ts +2 -1
- package/front_end/panels/timeline/InteractionsTrackAppender.ts +5 -1
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +2 -1
- package/front_end/panels/timeline/ThreadAppender.ts +12 -3
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +9 -4
- package/front_end/panels/timeline/TimelinePanel.ts +3 -2
- package/front_end/panels/timeline/TimelineUIUtils.ts +18 -12
- package/front_end/panels/timeline/TimingsTrackAppender.ts +6 -1
- package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +95 -82
- package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
- package/front_end/panels/timeline/components/cpuThrottlingSelector.css +17 -15
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +3 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +6 -9
- package/front_end/third_party/codemirror.next/package.json +2 -1
- package/front_end/third_party/diff/README.chromium +1 -0
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +0 -20
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +2 -23
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +0 -20
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/package.json +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +1 -21
- package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
- package/front_end/ui/components/text_editor/config.ts +36 -8
- package/front_end/ui/components/tooltips/Tooltip.ts +71 -34
- package/front_end/ui/legacy/README.md +33 -24
- package/front_end/ui/legacy/SearchableView.ts +19 -26
- package/front_end/ui/legacy/TextPrompt.ts +166 -1
- package/front_end/ui/legacy/Treeoutline.ts +16 -2
- package/front_end/ui/legacy/UIUtils.ts +15 -2
- package/front_end/ui/legacy/XElement.ts +0 -43
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +20 -4
- package/front_end/ui/visual_logging/KnownContextValues.ts +24 -6
- package/front_end/ui/visual_logging/README.md +43 -27
- package/package.json +1 -1
package/docs/checklist/README.md
CHANGED
@@ -46,7 +46,7 @@ in the Elements tab looks alright and works as expected (typically, this require
|
|
46
46
|
|
47
47
|
Verify that the new properties show up in the DevTools Console autocomplete functionality (typically, this requires no additional implementation effort).
|
48
48
|
To enable argument hints for new or changed parameterized functions, run
|
49
|
-
```
|
49
|
+
```bash
|
50
50
|
devtools-frontend/src/scripts/deps/roll_deps.py
|
51
51
|
```
|
52
52
|
to re-generate `devtools-frontend/src/front_end/models/javascript\_metadata/NativeFunctions.js` ([Example CL](http://crrev.com/c/3432787)).
|
@@ -88,7 +88,7 @@ Example for `:target`: [Chromium back-end CL](https://chromium-review.googlesour
|
|
88
88
|
|
89
89
|
To recognize new CSS properties/values in the DevTools Styles panel’s autocomplete functionality, roll
|
90
90
|
[Chromium’s `css_properties.json5`](https://source.chromium.org/chromium/chromium/src/+/main:third\_party/blink/renderer/core/css/css_properties.json5;drc=be2c473625b9c28a4ff6735547cb0c1b6743f4ae) into the `devtools-frontend` repository by running
|
91
|
-
```
|
91
|
+
```bash
|
92
92
|
devtools-frontend/src/scripts/deps/roll_deps.py
|
93
93
|
```
|
94
94
|
see this [example CL](https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2972583).
|
@@ -306,7 +306,7 @@ NLFs that contain control flow (e.g branches, loops, etc.).
|
|
306
306
|
|
307
307
|
Run `d8` with `--lcov` and check whether the produced coverage information is correct. E.g. like this:
|
308
308
|
|
309
|
-
```
|
309
|
+
```bash
|
310
310
|
./d8 --lcov=cov.info test.js
|
311
311
|
genhtml cov.info -o coverage
|
312
312
|
```
|
@@ -49,13 +49,13 @@ const base::FeatureParam<double> kDevToolsNewFeatureDoubleParam{
|
|
49
49
|
|
50
50
|
Start Chrome via command line including flags:
|
51
51
|
|
52
|
-
```
|
52
|
+
```bash
|
53
53
|
out/Default/chrome --enable-features=DevToolsNewFeature
|
54
54
|
```
|
55
55
|
|
56
56
|
You can even pass additional feature parameters:
|
57
57
|
|
58
|
-
```
|
58
|
+
```bash
|
59
59
|
out/Default/chrome --enable-features="DevToolsNewFeature:string_param/foo/double_param/0.5"
|
60
60
|
```
|
61
61
|
|
@@ -113,7 +113,8 @@ In DevTools, you need to register the experiment. This is done in
|
|
113
113
|
Root.Runtime.experiments.register(
|
114
114
|
'yourExperimentNameHere',
|
115
115
|
'User facing short description of experiment here',
|
116
|
-
false
|
116
|
+
false,
|
117
|
+
);
|
117
118
|
```
|
118
119
|
|
119
120
|
The first argument is the experiment's label, and **this must match the label
|
@@ -134,9 +135,9 @@ documentation and a way to provide feedback:
|
|
134
135
|
Root.Runtime.experiments.register(
|
135
136
|
'jsProfilerTemporarilyEnable',
|
136
137
|
'Enable JavaScript Profiler temporarily',
|
137
|
-
|
138
|
-
|
139
|
-
|
138
|
+
/* unstable= */ false,
|
139
|
+
/* documentation */ 'https://goo.gle/js-profiler-deprecation',
|
140
|
+
/* feedback */ 'https://crbug.com/1354548',
|
140
141
|
);
|
141
142
|
```
|
142
143
|
|
@@ -149,7 +150,7 @@ Once the experiment is registered, you can check if it is enabled and use this
|
|
149
150
|
to run certain code blocks conditionally:
|
150
151
|
|
151
152
|
```ts
|
152
|
-
if(Root.Runtime.experiments.isEnabled('yourExperimentNameHere')) {
|
153
|
-
|
153
|
+
if (Root.Runtime.experiments.isEnabled('yourExperimentNameHere')) {
|
154
|
+
// Experiment code here
|
154
155
|
}
|
155
156
|
```
|
@@ -43,7 +43,7 @@ set up your Chrome or Chromium instance for earlier versions of M-136 and M-135.
|
|
43
43
|
|
44
44
|
Then in your `devtools-frontend` checkout, use
|
45
45
|
|
46
|
-
```
|
46
|
+
```bash
|
47
47
|
./third_party/chrome/chrome-linux/chrome \
|
48
48
|
--disable-infobars \
|
49
49
|
--custom-devtools-frontend=file://$(realpath out/Default/gen/front_end)
|
@@ -51,7 +51,7 @@ Then in your `devtools-frontend` checkout, use
|
|
51
51
|
|
52
52
|
on Linux or
|
53
53
|
|
54
|
-
```
|
54
|
+
```bash
|
55
55
|
./third_party/chrome/chrome-mac/Google\ Chrome\ for\ Testing.app/Contents/MacOS/Google\ Chrome\ for\ Testing \
|
56
56
|
--disable-infobars \
|
57
57
|
--disable-features=MediaRouter \
|
@@ -15,7 +15,7 @@ Before proceeding, make sure you know the different
|
|
15
15
|
|
16
16
|
Code example:
|
17
17
|
|
18
|
-
```
|
18
|
+
```ts
|
19
19
|
import * as i18n from '../i18n/i18n.js';
|
20
20
|
|
21
21
|
// at the top of example.js file, after import statements
|
@@ -57,7 +57,7 @@ console.log(message2);
|
|
57
57
|
to it. If there isn't `UIStrings = {}` in the file, create one and add your
|
58
58
|
string, also register the new UIStrings into the `en-US.json` by adding:
|
59
59
|
|
60
|
-
```
|
60
|
+
```ts
|
61
61
|
// Filename should be relative to front_end folder
|
62
62
|
const str_ = i18n.i18n.registerUIStrings('<filename>', UIStrings);
|
63
63
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
@@ -145,7 +145,7 @@ The basic API to make a string (with or without placeholder) localizable. The
|
|
145
145
|
first argument is the string reference in `UIStrings` The second argument is an
|
146
146
|
object for placeholders (if any)
|
147
147
|
|
148
|
-
```
|
148
|
+
```ts
|
149
149
|
// at the top of example.js file, after import statements
|
150
150
|
|
151
151
|
const UIStrings = {
|
@@ -172,7 +172,7 @@ locale, which are not available until after DevTools has finished starting up.
|
|
172
172
|
Calls to `i18nString` in the module scope will therefore fail when the module is
|
173
173
|
imported.
|
174
174
|
|
175
|
-
```
|
175
|
+
```ts
|
176
176
|
// Fails because i18nString runs at module-import time.
|
177
177
|
Common.Settings.registerSettingExtension({
|
178
178
|
category: Common.Settings.SettingCategory.CONSOLE,
|
@@ -188,7 +188,7 @@ function notTopLevel() {
|
|
188
188
|
closure that returns a `LocalizedString`. It can be used in top-level calls;
|
189
189
|
just make sure use-sites know it's a function now.
|
190
190
|
|
191
|
-
```
|
191
|
+
```ts
|
192
192
|
// Works because i18nLazyString defers the loading of the translated string until later.
|
193
193
|
Common.Settings.registerSettingExtension({
|
194
194
|
category: Common.Settings.SettingCategory.CONSOLE,
|
@@ -207,7 +207,7 @@ This call returns a **span element**, not a string. It is used when you want to
|
|
207
207
|
construct a DOM element with a localizable string, or localizable content that
|
208
208
|
contains some other DOM element.
|
209
209
|
|
210
|
-
```
|
210
|
+
```ts
|
211
211
|
// Create the string in UIString
|
212
212
|
/**
|
213
213
|
*@description Message in Coverage View of the Coverage tab
|
@@ -228,7 +228,7 @@ This call is a named cast. Use it in places where a localized string is expected
|
|
228
228
|
but the term you want to use does not require translation. Instead of locking
|
229
229
|
the whole phrase or using a placeholder-only phrase, use `lockedString`.
|
230
230
|
|
231
|
-
```
|
231
|
+
```ts
|
232
232
|
someFunctionRequiringALocalizedString(i18n.i18n.lockedString('HTTP'));
|
233
233
|
```
|
234
234
|
|
@@ -240,7 +240,7 @@ languages!
|
|
240
240
|
|
241
241
|
**Good description**:
|
242
242
|
|
243
|
-
```
|
243
|
+
```ts
|
244
244
|
const UIStrings = {
|
245
245
|
/**
|
246
246
|
* @description Tooltip text that appears when hovering over the 'Focusable' attribute name under the Computed Properties section in the Accessibility pane of the Elements pane.
|
@@ -251,7 +251,7 @@ const UIStrings = {
|
|
251
251
|
|
252
252
|
**Bad description**:
|
253
253
|
|
254
|
-
```
|
254
|
+
```ts
|
255
255
|
const UIStrings = {
|
256
256
|
/**
|
257
257
|
* @description Elements pane 'Focusable' tooltip.
|
@@ -289,7 +289,7 @@ const UIStrings = {
|
|
289
289
|
Any text within the backticks will not be translated. For example, if the
|
290
290
|
'robots.txt' in string 'Requesting for robots.txt …' should not be translated:
|
291
291
|
|
292
|
-
```
|
292
|
+
```ts
|
293
293
|
// in example.js file
|
294
294
|
|
295
295
|
import * as i18n from '../i18n/i18n.js';
|
@@ -73,9 +73,9 @@ Open the file
|
|
73
73
|
`third_party/blink/renderer/core/inspector/inspector_protocol_config.json` and
|
74
74
|
under `protocol.options`, add your new domain:
|
75
75
|
|
76
|
-
```
|
76
|
+
```json
|
77
77
|
{
|
78
|
-
|
78
|
+
"domain": "YourNewDomain"
|
79
79
|
}
|
80
80
|
```
|
81
81
|
|
@@ -85,7 +85,7 @@ Build chromium as you normally would.
|
|
85
85
|
#### 1.6- See the newly generated protocol C++ files
|
86
86
|
Your new domain files should be generated in this folder:
|
87
87
|
|
88
|
-
```
|
88
|
+
```bash
|
89
89
|
src/out/Default/gen/third_party/blink/renderer/core/inspector/protocol/your_new_domain.cc
|
90
90
|
src/out/Default/gen/third_party/blink/renderer/core/inspector/protocol/your_new_domain.h
|
91
91
|
```
|
@@ -94,7 +94,7 @@ src/out/Default/gen/third_party/blink/renderer/core/inspector/protocol/your_new_
|
|
94
94
|
|
95
95
|
Open the file `devtools-frontend/front_end/core/protocol_client/InspectorBackend.ts` and add a new method to expose your Agent.
|
96
96
|
|
97
|
-
```
|
97
|
+
```ts
|
98
98
|
youNewDomainAgent(): ProtocolProxyApi.YourNewAgentApi {
|
99
99
|
return this.getAgent('YourNewAgent');
|
100
100
|
}
|
@@ -112,13 +112,14 @@ outputs = [
|
|
112
112
|
...
|
113
113
|
"inspector/protocol/your_new_domain.cc",
|
114
114
|
"inspector/protocol/your_new_domain.h",
|
115
|
+
]
|
115
116
|
```
|
116
117
|
|
117
118
|
### 2- Sync the browser_protocol files and generate the protocol resources
|
118
119
|
As mentioned before, there are many browser_protocol files. To synchronize the
|
119
120
|
modifications, run this command from your Chrome DevTools repository:
|
120
121
|
|
121
|
-
```
|
122
|
+
```bash
|
122
123
|
scripts/deps/roll_deps.py ~/chromium/src .
|
123
124
|
```
|
124
125
|
|
@@ -132,7 +133,7 @@ Chrome DevTools repository.
|
|
132
133
|
The Agent class should inherit the newly created protocol
|
133
134
|
`protocol::YourNewDomainAgent::Metainfo`
|
134
135
|
|
135
|
-
```
|
136
|
+
```cpp
|
136
137
|
class MODULES_EXPORT YourNewDomainAgent final : public InspectorBaseAgent<protocol::YourNewDomainAgent::Metainfo> {
|
137
138
|
```
|
138
139
|
|
@@ -141,7 +142,7 @@ The Agent must be registered with the Session. To do so, go to the file
|
|
141
142
|
`third_party/blink/renderer/modules/modules_initializer.cc` and append it to the
|
142
143
|
session in this method:
|
143
144
|
|
144
|
-
```
|
145
|
+
```cpp
|
145
146
|
void ModulesInitializer::InitInspectorAgentSession {
|
146
147
|
…
|
147
148
|
session->CreateAndAppend<YourNewAgent>...
|
@@ -151,7 +152,7 @@ session->CreateAndAppend<YourNewAgent>...
|
|
151
152
|
In the TypeScript class, your agent can now be accessible directly from the
|
152
153
|
target. With the target, you can simply access your agent like this:
|
153
154
|
|
154
|
-
```
|
155
|
+
```ts
|
155
156
|
initialize(target: SDK.Target.Target) {
|
156
157
|
target.yourNewDomainAgent();
|
157
158
|
}
|
@@ -54,7 +54,7 @@ workspace folders, it has to contain a `workspace` object with two properties:
|
|
54
54
|
|
55
55
|
An example `com.chrome.devtools.json` would look like this:
|
56
56
|
|
57
|
-
```
|
57
|
+
```json
|
58
58
|
{
|
59
59
|
"workspace": {
|
60
60
|
"root": "/Users/foobar/Projects/my-awesome-web-project",
|
@@ -81,7 +81,7 @@ turn on two feature flags in `about:flags`:
|
|
81
81
|
Instead of enabling the feature via `about:flags`, you can instead also enable
|
82
82
|
them from the command line:
|
83
83
|
|
84
|
-
```
|
84
|
+
```bash
|
85
85
|
google-chrome-canary --enable-features=DevToolsWellKnown,DevToolsAutomaticFileSystems
|
86
86
|
```
|
87
87
|
|
@@ -99,7 +99,7 @@ need to do is to create a `.well-known/appspecific` folder and place a
|
|
99
99
|
and you're directly serving the artifacts for your project from its source
|
100
100
|
directory in `/Users/foo/bar`, then you could can accomplish the setup via:
|
101
101
|
|
102
|
-
```
|
102
|
+
```bash
|
103
103
|
cd /Users/foo/bar
|
104
104
|
mkdir -p .well-known/appspecific
|
105
105
|
echo "{\"workspace\":{\"root\":\"${PWD}\",\"uuid\":\"`npx --package uuid uuid v4`\"}}" > .well-known/appspecific/com.chrome.devtools.json
|
package/docs/get_the_code.md
CHANGED
@@ -59,7 +59,6 @@ gn gen out/fast-build --args="devtools_skip_typecheck=true devtools_bundle=false
|
|
59
59
|
and use `npm run build -- -t fast-build` to build this target (you can of course
|
60
60
|
also just change the `Default` target to skip bundling and type checking).
|
61
61
|
|
62
|
-
|
63
62
|
### Rebuilding automatically
|
64
63
|
|
65
64
|
You can use
|
@@ -176,7 +175,6 @@ npm start -- --verbose
|
|
176
175
|
to enable verbose logging, which among other things, also prints all output from Chrome to the terminal, which is
|
177
176
|
otherwise suppressed.
|
178
177
|
|
179
|
-
|
180
178
|
##### Controlling the feature set
|
181
179
|
|
182
180
|
By default `npm start` will enable a bunch of experimental features (related to DevTools) that are considered ready for teamfood.
|
@@ -76,7 +76,7 @@ space.
|
|
76
76
|
|
77
77
|
Usage with lit-html:
|
78
78
|
|
79
|
-
```
|
79
|
+
```ts
|
80
80
|
html`<devtools-button class="some-class"
|
81
81
|
.variant=${Buttons.Button.Variant.PRIMARY}
|
82
82
|
.title=${i18nString(UIStrings.someString)}
|
@@ -86,13 +86,13 @@ html`<devtools-button class="some-class"
|
|
86
86
|
|
87
87
|
Usage with the imperative API:
|
88
88
|
|
89
|
-
```
|
89
|
+
```ts
|
90
90
|
const button = new Buttons.Button.Button();
|
91
91
|
button.data = {
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
variant: Buttons.Button.Variant.PRIMARY,
|
93
|
+
title: i18nString(UIStrings.someString),
|
94
|
+
jslogContext: 'some-context',
|
95
|
+
};
|
96
96
|
button.classList.add('some-class');
|
97
97
|
button.addEventListener('click', event => onClick(event));
|
98
98
|
```
|
@@ -164,28 +164,36 @@ button.addEventListener('click', event => onClick(event));
|
|
164
164
|
|
165
165
|
Usage with lit-html:
|
166
166
|
|
167
|
-
```
|
168
|
-
html`<select aria-label="Choose your champion"
|
169
|
-
@onchange=${onChange}>
|
167
|
+
```ts
|
168
|
+
html`<select aria-label="Choose your champion" @onchange=${onChange}>
|
170
169
|
<option hidden value="Choose your champion"></option>
|
171
|
-
<option
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
170
|
+
<option
|
171
|
+
jslog=${VisualLogging.item('hamster').track({ click: true })}
|
172
|
+
value="Hamster"
|
173
|
+
>
|
174
|
+
Hamster
|
175
|
+
</option>
|
176
|
+
<option
|
177
|
+
jslog=${VisualLogging.item('mouse').track({ click: true })}
|
178
|
+
value="Mouse"
|
179
|
+
>
|
180
|
+
Mouse
|
181
|
+
</option>
|
182
|
+
<option jslog=${VisualLogging.item('cat').track({ click: true })} value="Cat">
|
183
|
+
Cat
|
184
|
+
</option>
|
185
|
+
</select>`;
|
178
186
|
```
|
179
187
|
|
180
188
|
Usage with the imperative API:
|
181
189
|
|
182
|
-
```
|
190
|
+
```ts
|
183
191
|
const select = UI.UIUtils.createSelect('Choose your champion', [
|
184
192
|
'Hamster',
|
185
193
|
'Mouse',
|
186
194
|
'Cat',
|
187
195
|
]);
|
188
|
-
select.addEventListener('change', event => onChange(event))
|
196
|
+
select.addEventListener('change', event => onChange(event));
|
189
197
|
```
|
190
198
|
|
191
199
|
## Radio Buttons
|
@@ -212,16 +220,22 @@ select.addEventListener('change', event => onChange(event))
|
|
212
220
|
|
213
221
|
Usage with lit-html:
|
214
222
|
|
215
|
-
```
|
216
|
-
const jslog = VisualLogging.toggle()
|
217
|
-
|
223
|
+
```ts
|
224
|
+
const jslog = VisualLogging.toggle()
|
225
|
+
.track({ change: true })
|
226
|
+
.context(jslogContext);
|
227
|
+
html`<label><input type="radio" name=${name} jslog=${jslog} />${title}</label>`;
|
218
228
|
```
|
219
229
|
|
220
230
|
Usage with the imperative API:
|
221
231
|
|
222
|
-
```
|
223
|
-
const {label, radio} = UI.UIUtils.createRadioButton(
|
224
|
-
|
232
|
+
```ts
|
233
|
+
const { label, radio } = UI.UIUtils.createRadioButton(
|
234
|
+
name,
|
235
|
+
title,
|
236
|
+
jslogContext,
|
237
|
+
);
|
238
|
+
radio.addEventListener('change', event => onChange(event));
|
225
239
|
```
|
226
240
|
|
227
241
|
## Sliders
|
@@ -247,19 +261,21 @@ radio.addEventListener('change', event => onChange(event))
|
|
247
261
|
|
248
262
|
Usage with lit-html:
|
249
263
|
|
250
|
-
```
|
251
|
-
html`<input
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
264
|
+
```ts
|
265
|
+
html`<input
|
266
|
+
type="range"
|
267
|
+
min=${min}
|
268
|
+
max=${max}
|
269
|
+
tabindex=${tabIndex}
|
270
|
+
@change=${onChange}
|
271
|
+
/>`;
|
256
272
|
```
|
257
273
|
|
258
274
|
Usage with the imperative API:
|
259
275
|
|
260
|
-
```
|
276
|
+
```ts
|
261
277
|
const slider = UI.UIUtils.createSlider(min, max, tabIndex);
|
262
|
-
slider.addEventListener('change', event => onChange(event))
|
278
|
+
slider.addEventListener('change', event => onChange(event));
|
263
279
|
```
|
264
280
|
|
265
281
|
## Icons
|
@@ -293,13 +309,13 @@ For some frequently used icons e.g. cross-circle, warning-filled etc. colors are
|
|
293
309
|
|
294
310
|
Usage with lit-html:
|
295
311
|
|
296
|
-
```
|
297
|
-
html`<devtools-icon name=${'some-icon-name'}></devtools-icon
|
312
|
+
```ts
|
313
|
+
html`<devtools-icon name=${'some-icon-name'}></devtools-icon>`;
|
298
314
|
```
|
299
315
|
|
300
316
|
Usage with the imperative API:
|
301
317
|
|
302
|
-
```
|
318
|
+
```ts
|
303
319
|
const someIcon = IconButton.Icon.create('some-icon-name', 'some-class');
|
304
320
|
```
|
305
321
|
|
@@ -379,53 +395,71 @@ Generally, we do not recommend using shortcuts in context menus since this goes
|
|
379
395
|
|
380
396
|
Usage with lit-html (left-click on a `<devtools-menu-button>` opens a menu):
|
381
397
|
|
382
|
-
```
|
398
|
+
```ts
|
383
399
|
html`
|
384
|
-
<devtools-menu-button
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
400
|
+
<devtools-menu-button
|
401
|
+
icon-name="some-icon-name"
|
402
|
+
.populateMenuCall=${(menu: UI.ContextMenu.ContextMenu) => {
|
403
|
+
menu.defaultSection().appendItem(
|
404
|
+
'Item',
|
405
|
+
() => {
|
406
|
+
console.log('Item clicked');
|
407
|
+
},
|
408
|
+
{ jslogContext: 'item' },
|
409
|
+
);
|
410
|
+
}}
|
411
|
+
jslogContext="my-menu-button"
|
412
|
+
></devtools-menu-button>
|
413
|
+
`;
|
394
414
|
```
|
395
415
|
|
396
416
|
Usage with the imperative API (menu shows on a right-click)
|
397
417
|
|
398
418
|
Various simple menu items:
|
399
419
|
|
400
|
-
```
|
420
|
+
```ts
|
401
421
|
const element = this.shadowRoot.querySelector('.element-to-add-menu-to');
|
402
422
|
element.addEventListener('contextmenu', (event: MouseEvent) => {
|
403
423
|
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
404
424
|
|
405
|
-
// Regular item
|
406
|
-
contextMenu.defaultSection().appendItem(
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
425
|
+
// Regular item
|
426
|
+
contextMenu.defaultSection().appendItem(
|
427
|
+
'Regular item',
|
428
|
+
() => {
|
429
|
+
console.log('Regular item clicked ');
|
430
|
+
},
|
431
|
+
{ jslogContext: 'regular-item' },
|
432
|
+
);
|
433
|
+
|
434
|
+
// Disabled item
|
435
|
+
contextMenu.defaultSection().appendItem(
|
436
|
+
'Disabled item',
|
437
|
+
() => {
|
438
|
+
console.log('Will not be printed');
|
439
|
+
},
|
440
|
+
{ jslogContext: 'disabled-item', disabled: true },
|
441
|
+
);
|
442
|
+
|
443
|
+
// Experimental item
|
444
|
+
const item = contextMenu.defaultSection().appendItem(
|
445
|
+
'Experimental item',
|
446
|
+
() => {
|
447
|
+
console.log('Experimental item clicked');
|
448
|
+
},
|
449
|
+
{ jslogContext: 'experimental-item', isPreviewFeature: true },
|
450
|
+
);
|
451
|
+
|
452
|
+
// Separator
|
423
453
|
contextMenu.defaultSection().appendSeparator();
|
424
454
|
|
425
|
-
// Checkbox item
|
426
|
-
contextMenu.defaultSection().appendCheckboxItem(
|
427
|
-
|
428
|
-
|
455
|
+
// Checkbox item
|
456
|
+
contextMenu.defaultSection().appendCheckboxItem(
|
457
|
+
'Checkbox item',
|
458
|
+
() => {
|
459
|
+
console.log('Checkbox item clicked');
|
460
|
+
},
|
461
|
+
{ checked: true, jslogContext: 'checkbox-item' },
|
462
|
+
);
|
429
463
|
|
430
464
|
void contextMenu.show();
|
431
465
|
});
|
@@ -433,39 +467,85 @@ element.addEventListener('contextmenu', (event: MouseEvent) => {
|
|
433
467
|
|
434
468
|
Custom section:
|
435
469
|
|
436
|
-
```
|
437
|
-
|
438
|
-
|
470
|
+
```ts
|
471
|
+
const customSection = contextMenu.section('Custom section');
|
472
|
+
customSection.appendItem(
|
473
|
+
'Section inner item 1',
|
474
|
+
() => {
|
475
|
+
/* ... */
|
476
|
+
},
|
477
|
+
{ jslogContext: 'my-inner-item-1' },
|
478
|
+
);
|
439
479
|
|
440
|
-
|
480
|
+
customSection.appendItem(
|
481
|
+
'Section inner item 2',
|
482
|
+
() => {
|
483
|
+
/* ... */
|
484
|
+
},
|
485
|
+
{ jslogContext: 'my-inner-item-2' },
|
486
|
+
);
|
441
487
|
```
|
442
488
|
|
443
489
|
Sub menu:
|
444
490
|
|
445
|
-
```
|
446
|
-
const subMenu = contextMenu
|
447
|
-
|
448
|
-
|
491
|
+
```ts
|
492
|
+
const subMenu = contextMenu
|
493
|
+
.defaultSection()
|
494
|
+
.appendSubMenuItem(
|
495
|
+
'Item to open sub menu',
|
496
|
+
/* disabled */ false,
|
497
|
+
'my-sub-menu',
|
498
|
+
);
|
499
|
+
subMenu.defaultSection().appendItem(
|
500
|
+
'Sub menu inner item 1',
|
501
|
+
() => {
|
502
|
+
/* ... */
|
503
|
+
},
|
504
|
+
{ jslogContext: 'my-inner-item-1' },
|
505
|
+
);
|
506
|
+
subMenu.defaultSection().appendItem(
|
507
|
+
'Sub menu inner item 2',
|
508
|
+
() => {
|
509
|
+
/* ... */
|
510
|
+
},
|
511
|
+
{ jslogContext: 'my-inner-item-2' },
|
512
|
+
);
|
449
513
|
```
|
450
514
|
|
451
515
|
Context menu provider registration (adds items dynamically based on the context menu’s target):
|
452
516
|
|
453
517
|
```js
|
454
518
|
// Define provider
|
455
|
-
class MyCustomNodeProvider
|
456
|
-
|
519
|
+
class MyCustomNodeProvider
|
520
|
+
implements UI.ContextMenu.Provider<SomeTarget | SomeOtherTarget>
|
521
|
+
{
|
522
|
+
appendApplicableItems(
|
523
|
+
event: Event,
|
524
|
+
contextMenu: UI.ContextMenu.ContextMenu,
|
525
|
+
target: SomeTarget | SomeOtherTarget,
|
526
|
+
) {
|
457
527
|
if (target instanceof SomeTarget) {
|
458
|
-
contextMenu.defaultSection().appendItem(
|
459
|
-
|
528
|
+
contextMenu.defaultSection().appendItem(
|
529
|
+
'Item 1',
|
530
|
+
() => {
|
531
|
+
console.log('Item 1 clicked');
|
532
|
+
},
|
533
|
+
{ jsLogContext: 'my-item-1' },
|
534
|
+
);
|
460
535
|
} else {
|
461
|
-
contextMenu.defaultSection().appendItem(
|
462
|
-
|
536
|
+
contextMenu.defaultSection().appendItem(
|
537
|
+
'Item 2',
|
538
|
+
() => {
|
539
|
+
console.log('Item 2 clicked');
|
540
|
+
},
|
541
|
+
{ jsLogContext: 'my-item-2' },
|
542
|
+
);
|
463
543
|
}
|
464
544
|
}
|
465
545
|
}
|
466
546
|
```
|
467
547
|
|
468
|
-
```
|
548
|
+
```ts
|
469
549
|
// Register provider
|
470
550
|
UI.ContextMenu.registerProvider<SDK.DOMModel.DOMNode>({
|
471
551
|
contextTypes: () => [SomeTarget, SomeOtherTarget],
|
@@ -479,11 +559,12 @@ UI.ContextMenu.registerProvider<SDK.DOMModel.DOMNode>({
|
|
479
559
|
|
480
560
|
Static menu item registration via ItemLocation (adds an action to a predefined menu location):
|
481
561
|
|
482
|
-
```
|
562
|
+
```ts
|
483
563
|
UI.ContextMenu.registerItem({
|
484
564
|
location: UI.ContextMenu.ItemLocation.NAVIGATOR_MENU_DEFAULT,
|
485
565
|
actionId: 'quick-open.show',
|
486
566
|
order: undefined,
|
487
567
|
});
|
488
568
|
```
|
569
|
+
|
489
570
|
This will automatically add the "Open file" action to the context menu that appears when clicking the Elements panel's 3-dot button.
|